﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

namespace Ecreate.Web.usercontrol
{
    public partial class ucSaleList : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            //string divul = "<div id=\"bags\"><div class=\"goods_list\"><ul>{0}</ul></div></div>";
            //string onclick = "onclick=\"window.open('{0}', '产品', 'height=300, width=300, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=n o, status=no')\"";
            //string li = "<li><a href=\"#\" {0}><img alt=\"{1}\" src=\"{2}\" /></a><a class=\"goods_name\" title=\"{1}\" href=\"#\" {0}>{1}</a>"
            //            + "<div class=\"pricebox\"><label>价格:</label><span class=\"price\">￥{3}元</span></div></li>";
            string li = "<ul class=\"cont_03_c\"><li><p><a href=\"{0}\" target=\"_blank\"><img border=0 width=100 height=100 alt=\"{1}\" src=\"{2}\" /></a></p>"
                + "<p class=\"txt blue\"><a title=\"{1}\" href=\"{0}\" target=\"_blank\">{1}</a></p>"
                + "<p><span class=\"fl red\">价格：</span><span class=\"sell_prize fl\">{3}</span></p></li></ul>";
            //0:图片链接地址;1:产品名称;2:图片位置;3:价格
            string sql = "select top 6 * from t_product where issale='1' and isdown='0'";
            DataTable dt = GG.GetTable(sql);
            string items = "";
            foreach (DataRow dr in dt.Rows)
            {
                if (items != "")
                {
                    items += "<div class=\"cont_pic_line1\">&nbsp;</div>";
                }
                string s1 = "pages/ProductPage.aspx?pid=" + dr["pid"].ToString();
                //s1 = string.Format(onclick, new string[] { s1 });
                string s2 = dr["pname"].ToString();
                string s3 = dr["pimageurl"].ToString();
                string s4 = dr["price"].ToString();
                items += string.Format(li, new string[] { s1, s2, s3, s4 });
            }
            Literal1.Text = items;
        }
    }
}